UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IooTs8sIg4lV8ub4E0VR2ceSqZTl1NF3w1xl9vaNkP4='
WHERE
key_id = '350f85643302b1c5cb0ca944761443de805361c401f8b9105cf637f5b6e2c854'
AND (
token = 'IooTs8sIg4lV8ub4E0VR2ceSqZTl1NF3w1xl9vaNkP4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)