UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tq0Et6MN1obfYclcNr11I1Pex10Ze1VaAU53ypRovuo='
WHERE
key_id = '60c85434d4cf320fa9b54df54132c551636a457d6d08b39ae441ebe9779be39c'
AND (
token = 'tq0Et6MN1obfYclcNr11I1Pex10Ze1VaAU53ypRovuo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)