Set values conditionally in Postgres UPSERT
...
SET   col1 = COALESCE(excluded.col1, table.col1)
...


Of course, both tables must be visible.

If you are updating table1 and that's the only change you make it's much more efficient to use a WHERE clause:

...
SET   col1 = excluded.col1
WHERE excluded.col1 IS NOT NULL
AND   excluded.col1 IS DISTINCT FROM table1.col1 -- to avoid empty updates
...


About the added second condition:


How do I (or can I) SELECT DISTINCT on multiple columns?