If you select an existing number of points, add it to the client, and then write the updated value back to the database, then you will have a race condition. As you noticed, it is possible that some submissions will not be taken into account.
Instead, you should try using atomic update and avoid the problem:
UPDATE user SET points = points + 1 WHERE id = 42
An alternative is to read with SELECT ... FOR UPDATE . In the documentation:
If you use FOR UPDATE with a storage engine that uses page or row locking, the rows checked by the query are write-locked until the end of the current transaction. Using LOCK IN SHARE MODE sets a general lock, allowing other transactions to read verified rows, but not to update or delete them. See Section 14.2.8.3, “CHOOSE ... FOR UPDATE AND CHOOSE ... BLOCK IN BLOCK READING PROMOTION
source share