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