UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZWIb3gox8p61dZDHO6D9SP6UaWOdSKxToIrxFRJha3E='
WHERE
key_id = 'd1f116513973b550cfe06e6cd4c35dfbc9a2753d819b39c914f617a60022d978'
AND (
token = 'ZWIb3gox8p61dZDHO6D9SP6UaWOdSKxToIrxFRJha3E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)