EDIT: Oh, what table types are you operating on, cause on myisam the logic would be completely different than on innodb or bdb. I'm assuming you've got transactions, but with myisam you don't. Let me know and I'll clarify what I'm saying here to that type of table. You can make this work with either, btw... just differently and with different implications.
OK. The problem you're really fighting here is a race condition. Assume there's two transactions doing this at the same time. If you do it with a select on one table before you insert to another, and two transactions do that at once, on opposite tables, you can get a double entry.
This kind of says that maybe your table design is wrong. If this is a single column that both tables would share, but nothing else would be shared, then you'd be better off with one table with the URL referred to by the other two tables.
If the two tables are basically the same, but for being two different tables right now, then you make another field in the table design, merge the two, and use that to tell them apart.
If you absolutely can't do either, then you first insert into the "wrong" table. If the insert works, then there's no match. Then you insert into the correct table. If you can't insert, then something went wrong, because nothing should be inserted without putting something into the other table first right? Otherwise you insert into the other table, then go back and delete the dummy row in the other table as soon as you're done.
If you do this in a serializable transaction, then no other connections ever see tne "fake" row. If two things go to insert at the same time, one will wait for the other, since both can't insert, usually even in a transaction, against a unique key.
But I'd really redesign the tables into one with 2 or more entries for another field to differentiate them.