How to update posts’ custom taxonomy selection?

Sorted using this:

To set to active:

    <?php  $post_id = 58;
      $tag = array( 661 );
         wp_set_post_terms( $post_id, $tag, 'status' ); ?>

To set to inactive:

    <?php  $post_id = 58;
      $tag = array( 662 );
         wp_set_post_terms( $post_id, $tag, 'status' ); ?>