UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aZx7kBes15HHtt36a06zw58I6v0gzoLcxVUcz8YyaAI='
WHERE
key_id = '7acf47c33cf2625098ce0667cc2a87b060f9fd75add8abb37b50ca50e1427333'
AND (
token = 'aZx7kBes15HHtt36a06zw58I6v0gzoLcxVUcz8YyaAI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)