UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B5SJ8yFUVk7uU3SKui1PdzUrWUax6/c55BPkktcmCVM='
WHERE
key_id = 'be56b79a139a7d0fc640f0ac1024aeb3e0221b3966ce2f1b45a13c0ed353ce46'
AND (
token = 'B5SJ8yFUVk7uU3SKui1PdzUrWUax6/c55BPkktcmCVM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)