Webform conditions with memberships
I think you could use hook_webform_submission_presave 

http://api.drupal.psu.edu/api/drupal/modules%21contrib%21webform%21webform.api.php/group/webform_hooks/nittany7

But hook_civicrm_pre might be better
https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_pre/