UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GsysO13OsESrtDMbgPpM/uhiyCEqEbPwJJx0m9F0pX4='
WHERE
key_id = 'f490b160e9f0f3d529e9ca3c32c44fda9b4a2ea33c5ea26f115c8870aadb99e8'
AND (
token = 'GsysO13OsESrtDMbgPpM/uhiyCEqEbPwJJx0m9F0pX4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)