Most of the time I try to handle this with a submit button where it takes the values of the checkboxes and does everything you want them to do at once. As you have it, it looks like it's doing 2 seperate DB queries (not concurrent) everytime the user checks/unchecks the box. Sometimes I can see where that would be required but if it isn't, then see if you can find a way to simplify the process.
Either way, I think you probably want to look into creating a 'Stored Procedure' in the DB and utilize a 'Transaction' which is similar to a Try/Catch in that it can be made to execute all of the queries in a single transaction or none at all if it encounters an error. There are a lot of other things that can be done with Transactions (i.e. rollback, continue, etc) but that's another topic entirely.
For your purposes, try a Transaction within a Stored Procedure. It should accomplish what you're trying to do.