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