UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R8a7ssnzPpivLU1E4eax2IfgRWJe2H8rIYEGdXxPFIA='
WHERE
key_id = '0cacc10fa23dbc54dd6cef24ccffcb5e0eb310b94fad94512b9d88f74777c37f'
AND (
token = 'R8a7ssnzPpivLU1E4eax2IfgRWJe2H8rIYEGdXxPFIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)