UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0PwIHnOwzK8B3Yh5Kb9vcH6OrgtP7zUnF572buJA29Q='
WHERE
key_id = 'a492ed5b365bd03bd452f5a1e621b92094a3967ca909f6f31941597b1c4b4788'
AND (
token = '0PwIHnOwzK8B3Yh5Kb9vcH6OrgtP7zUnF572buJA29Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)