unique_id() need 2 queries to execute for get pseudo rand seed. I think it can be done with one query to config table but I don't know if its still secure so.. I've updated this funcation to something like this:
If you are concerned with database latency you can write a stored procedure that would perform computation(s) inside mysql with a single roundtrip.
It's a little too late on a Saturday for me to be able to comment on security of your proposed solution, but it does certainly not appear to be as strong as a /dev/random read just based on the functions you are using.