UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eiRrAR0huExzj7cNfQGAzvDTyclRcwZX02lgrvaUwKo='
WHERE
key_id = '9bfb93be685578f7b5edd505e40b1df295b6212ad5f04f5ec2871f396ee6698e'
AND (
token = 'eiRrAR0huExzj7cNfQGAzvDTyclRcwZX02lgrvaUwKo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)