UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ceEk4ZveF/xV2h8R9BEZce7Eo9reQYVOTTQiYXNa5sk='
WHERE
key_id = '8b85eac7b6dac049fcc84297fb0b378de880a47b9cd054814965a69d8f0fc64e'
AND (
token = 'ceEk4ZveF/xV2h8R9BEZce7Eo9reQYVOTTQiYXNa5sk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)