With this flag, once you read the data it stays locked until the transaction in which you read the data commits. Therefore, processing of the second transaction is blocked. Naturally, this works only with pessimistic locking.
With optimistic locking, we remember version of entry read and when (and only if) the same transaction later updates this entry, it checks that it's updating the same version as was read. If another transaction modified the data in between, the transaction rollbacks. This is called write skew check.
Naturally, the locks are only for the same key, right?