DB: diagnose failure setting state to current value

With MySQL we can get zero rows updated when setting the state to its
current value.  Therefore before raising an error about the lack
of rows being updated, check whether the reason for the failure
was that the job's state didn't need updating.
DB: check one row is updated when setting location