When I studies Databases in college, we learnt the concept of locks
The idea was to achieve transactional isolation. Or two operations operating on the same record did not have any side effects on the other.
A database lock is used to “lock” some data in a database so that only one database user/session may update that particular data. So, database locks exist to prevent two or more database users from updating the same exact piece of data at the same exact time.