Is your target table large?
because if not, you could create your target table as a dynamic lookup,
and in an expression to to it and check if its exists or not,
then in some flags you assign values for insert or update.