UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M+1ZWC5YvEZm/kAe9Ya/j6FY3eDojjHq6vmtmd+IYW0='
WHERE
key_id = 'd7727f5fc3f76b4885bfcee8032428c43680a0568d5dd0a3cc9cd07900b1979c'
AND (
token = 'M+1ZWC5YvEZm/kAe9Ya/j6FY3eDojjHq6vmtmd+IYW0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)