UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tDfT1JNN7nqhRmZqOEdl0kESHAc9DHkWnnxGsAMSmcU='
WHERE
key_id = 'aac17464ad7e89aa43578a03185b66e0e98bcfba9454738aceffb180844b4b3a'
AND (
token = 'tDfT1JNN7nqhRmZqOEdl0kESHAc9DHkWnnxGsAMSmcU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)