UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tUrqNJoUwzt7HEIk7PdMzYqrvY47Dh2/KBU/p8ExaUs='
WHERE
key_id = 'f8ccdc6c223dacfb100c33a4c5f38f0b7a358357f7160131e02d74a548f4857a'
AND (
token = 'tUrqNJoUwzt7HEIk7PdMzYqrvY47Dh2/KBU/p8ExaUs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)