This problem related with network, due to slow IP communication.
If you do this task by a stored procedure then you can avoid this as stored procedures resides at server end. For it first put all your uniq_ids in a cursor (under stored procedure) then update one by one.
You can call this stored procedure either manually , by event in mysql or windows scheduler or cron job.