MySQL - Avoid to select, and update, the same record on repeatable_read
问题 i'm developping a PHP service that need to get a unique TOKEN from a MySQL table. The table is like: ID TOKEN ID_PROCESS 1 AAAAA 0 2 BBBBB 0 3 CCCCC 0 The table has millions of records with already generated TOKEN. I need to be extra sure that, for example, the record with ID = 1 is selected and then updated ( UPDATE table set ID_PROCESS = 123 WHERE ID = 1) from one user and that nobody else could select it and then update it overwriting the former update. For selecting an available TOKEN i