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