UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TCstM9PCG9jfrzUPWcoCJhA+jNi83FVAIKt7yMtbK38='
WHERE
key_id = '77df8d81584c8e78181021c73acca9d86bc9cdc72dffca2ea647c2433f6922de'
AND (
token = 'TCstM9PCG9jfrzUPWcoCJhA+jNi83FVAIKt7yMtbK38='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)