UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HFO9Gnj6AsUWBPviAGjngn/f+cUHRSabjEAsh1n5St4='
WHERE
key_id = '278aa5c65a5f58ad65f9760705a865b72a35972766b78f87635d5eaedc0453b7'
AND (
token = 'HFO9Gnj6AsUWBPviAGjngn/f+cUHRSabjEAsh1n5St4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)