Collection Update Time Out

I have 30k rows of data in which I need to change one field in 900 of them.
I am setting filters to show the ones I should change and adding actions on a button through which every clicks updates the data I want.
Everything works fine but the problem is the connection is lost so frequently so that I can not manage to make the changes.
I would be happy if anybody knows a better way.