changed the order of update/insert for postgres

With the normal order, updatedevices can end up filling the postgres logs with thousands of lines like this:

    2014-01-09 22:20:14 EST ERROR:  duplicate key value violates unique constraint "ipblock1"
    2014-01-09 22:20:14 EST DETAIL:  Key (address, prefix)=(184398081, 32) already exists.
    2014-01-09 22:20:14 EST STATEMENT:  INSERT INTO ipblock
                                                  (address,prefix,version,status,first_seen,last_seen)
                                                   VALUES ($1, $2, $3, $4, $5, $6)

This fixes it so UPDATE is tried first, then INSERT if no rows were updated.