There is a request of this type:
SELECT `id` FROM `table` WHERE `index1` = :index1 AND `index2` = :index2 AND `index3` = :index3 AND `index4` = :index4 FOR UPDATE .. where id is the primary key, and indexN are columns with indices.
Further, on the basis of the existence of an id , either the insertion of a new INSERT line or its update UPDATE should be performed.
The first question is: will the FOR UPDATE blocked from changing other rows in which part of the indexN indexes will match the value specified in WHERE ?
And the second question: is the INSERT ON DUPLICATE KEY UPDATE operation more efficient than the one indicated above, if it is assumed that the INSERT is a one-time operation, whereas the subsequent UPDATE will be the overwhelming majority?