mysqldump with INSERT ... ON DUPLICATE
There are options to help you in this:

  --insert-ignore     Insert rows with INSERT IGNORE.
  --replace           Use REPLACE INTO instead of INSERT INTO.
  -t, --no-create-info
                      Don't write table creation info.


Keep this paradigm in mind


mysqldump everything from DB1 into DUMP1
load DUMP1 into DB3
mysqldump everything from DB2 using --replace (or --insert-ignore)
and --no-create-info into DUMP2
load DUMP2 into DB3