This doesn't look right to me.  Keep going while the rows affected is *less than* the batch size?  Shouldn't it be "keep going while the rows affected equals the batch size?"

What if there are more than 50 iterations of work to do, then what?  Won't that lead to more records building up since we only do this once daily?