UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uXsQNWTbHiKTWuMilgTS5YNqyuYtpPSSMAAX1y6PVMw='
WHERE
key_id = '3f021880f78ad4494e99b72bb544c51820312c1e83afe23189766c05f9f4bc60'
AND (
token = 'uXsQNWTbHiKTWuMilgTS5YNqyuYtpPSSMAAX1y6PVMw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)