UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KuGHFJ8ifw08scRPb76oE4Vox5E2khoQx3BpglgXbYI=' 
WHERE 
  key_id = '0e81014deb7bad27f5f44ea9e1c35c2fbddfda68f6679a34e310bdc00e6f3236' 
  AND (
    token = 'KuGHFJ8ifw08scRPb76oE4Vox5E2khoQx3BpglgXbYI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038