Yes, it is possible to lock records. Please make sure that you are using FOR UPDATE to prevent these race conditions:
Apex allows you to lock sObject records while they’re being updated in order to prevent race conditions and other thread safety problems. - Locking Statements
To do so you had to add to your statement
FOR UPDATE. And the resulting statement would look like this:
List<Lead> leads = [SELECT ID FROM Lead FOR Update];
The result of locking is explained as well:
While the records are locked by a client, the locking client can modify their field values in the database in the same transaction. Other clients have to wait until the transaction completes and the records are no longer locked before being able to update the same records. Other clients can still query the same records while they’re locked.
So it is possible to query but not to update these records.
However, to make sure that your code runs without running into race conditions, you should consider using
Besides from locking records it is possible to generate deadlocks. Learn more about Deadlock avoidance: here.