Here is an alternative to a PHP and recordset based approach that you could incorporate in appropriate sql patch :
ALTER TABLE `patient_data` ADD `uuid` binary(16) DEFAULT NULL;
CREATE UNIQUE INDEX `uuid` ON `patient_data` (`uuid`);
UPDATE `patient_data` SET `uuid` = unhex(replace(uuid(),'-','')) WHERE `uuid` IS NULL;
SELECT `uuid`, count(`uuid`) from `patient_data` group by `uuid` having count(`uuid`)>1;
The last statement is to confirm that mysql did not insert duplicate uuid as some have reported.
For a modestly configured host, 100K rows took less than 10 seconds for the UUID insertion.
mySQL 8 or equivalent MariaDB support use of functions in default. So you should be able to let DB do the work of initializing UUIDs with unhex(replace(uuid(),'-',''))
.