UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P+H7gGkkKFZh+CYJmbq8uZCmzv88xxHuerfbs/Tqx78='
WHERE
key_id = '7f0ecb04af31765ec4f8675c898d4e815d58d1379b6708c66848247071f6140a'
AND (
token = 'P+H7gGkkKFZh+CYJmbq8uZCmzv88xxHuerfbs/Tqx78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)