Custom comment access
You can get code from Comment Permissions and Comment Access modules.

something like 

function comment_perm_form_alter(&amp;$form, $form_state, $form_id) {
  #comment_node_merci_reservation_form
  if ($form['#id'] == 'comment-form' and arg(0) == 'comment') {
    $types = variable_get('comment_perm_node_types', array());
    $form_id_types = array();
    if (is_array($types)) {
      foreach ($types as $type) {
        if ($form_id == 'comment_node_' . $type . '_form') {

          $nid = $form['nid']['#value'];
          if (! comment_perm_access($nid)) {
            // for comment reply pages, redirect back to the node
            if (arg(0) == 'comment' &amp;&amp; arg(1) == 'reply' &amp;&amp; is_numeric(arg(2))) {
              drupal_set_message(_comment_perm_access_denied_message($nid), 'error');
              drupal_goto('node/' . arg(2));
    }
  }

          if (arg(0) == 'comment' &amp;&amp; arg(2) == 'edit' &amp;&amp; is_numeric(arg(1))) {
            if (! comment_perm_edit_access($nid)) {
              drupal_set_message(_comment_perm_access_denied_message($nid), 'error');
              drupal_goto('node/' . $nid);
            }
          }
      }
  }
    }
  }

}


then you can add you own condition.

You can also use above module ,if it is fulfilling your requirement.