I have a MySQL db with tables set up like this:
Table1 Table2 ------ ------ id id, fk to Table1.id name name
upd = table1.update()\ .values(id=table2.c.id)\ .where(table1.c.name == table2.c.name)
should do it, but if you really have all those foreign keys, you might get errors doing such updates.