Issue #276: Optimize db_merge() to use one fewer query on updates.

PR for https://github.com/backdrop/backdrop-issues/issues/276.