UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZBNjn6IfQJASsie1xoN3xwzFLWSC8imDV8fdMzlx8TE='
WHERE
key_id = 'dabf3693068f3c7cc150a4beacc45e3ca24e6e3da77f36c38c6641ac66d33692'
AND (
token = 'ZBNjn6IfQJASsie1xoN3xwzFLWSC8imDV8fdMzlx8TE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)