Hi Carlos,
Unless I'm missing something here, your queries are probably being called from a programming language (java/c# etc) and your database access api should support transactions. If you perform both operations under the same db transaction and commit your transaction things should be fine. If there is a problem with the first INSERT, your api should throw an exception and you won't be able to commit the transaction (you may/may not need to call rollback in your catch block), so it'll either be both calls executed or none.
You may want to read about how db transactions are handled in your programming environment.
Regards
Seref