UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mn7LQPATt7xkMlC+c/vqVWlWblqXNOak8sGDgWunaI0='
WHERE
key_id = 'ffbe75acef6b9cd9f28c7e1308d29ac577dd2527948042da8d0a256ab41705eb'
AND (
token = 'Mn7LQPATt7xkMlC+c/vqVWlWblqXNOak8sGDgWunaI0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)