My background is in Oracle, but I believe that most database systems operate the same locking principle…
Try a single UPDATE statement: update my_table set FieldM = nvl( FieldM, 0 ) + 1 where FieldA=123 and FieldB=456.
If the WHERE clause identifies a single row, then this is straightforward. The row is locked, so other processes doing the same UPDATE can’t read it until the change has been committed (because it’s an UPDATE, not a SELECT).
If the WHERE clause doesn’t identify a single row, the implication is that you would be updating a column in ALL the rows to the same value. Of course, once this has worked once (ie all the FieldM values are the same) then the UPDATE statement above would work fine – it’s just that it would lock More than one row. There’s no need for the MAX function because all the rows identified by the WHERE clause will keep the same value for FieldM. The trick is to lock everyone out of the table while you get all the values for FieldM set correctly for that first time.