UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8bcfVfKxchcE219Yf6FWA2x5H5LaiWg1F+7QxiP6Znw='
WHERE
key_id = 'fd1c89b79bb3bb5fbaf97c4044311d1cc02ce6518e93170a0060849256eb2548'
AND (
token = '8bcfVfKxchcE219Yf6FWA2x5H5LaiWg1F+7QxiP6Znw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)