UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bQEoUHdijyfkkAEruWW9p6yHCSBYPA5U9rWSDaSy6w0='
WHERE
key_id = '1c9681d28ae673747217ae1e609cf09935cbd8f05743372120437bc7ad9c8b45'
AND (
token = 'bQEoUHdijyfkkAEruWW9p6yHCSBYPA5U9rWSDaSy6w0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)