UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9n5hIU2cQFoFM78uUuOzhyK6fqVrdbib4zHcKZf1FEk='
WHERE
key_id = 'c54274de7bc6d2bbc1aa0900cc30a22d4863e0a35019827c4d71bf8ad3b0931d'
AND (
token = '9n5hIU2cQFoFM78uUuOzhyK6fqVrdbib4zHcKZf1FEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)