UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Czsfxqhw7iGNtVG3Gf0JTgKX4xLxvNlL7in+/Eh7Ldo='
WHERE
key_id = 'e312fd745bd2ce2008d8404c148e70673872c002ee95c08f2c3fd584ed371ecb'
AND (
token = 'Czsfxqhw7iGNtVG3Gf0JTgKX4xLxvNlL7in+/Eh7Ldo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)