I wouldn't consider any retail job (e.g. cashier), a middle class job. Nobody wants to think of themselves as lower class but clearly there is a delineation somewhere? Are you still considered middle class if you are unemployed and the industry you worked in left town?
Similar things will happen to small towns along trucking routes if tractor-trailer driving becomes automated. You will have less need for restaurants, small hotels, truck-stops, etc. if an automated truck is passing through at 3am.
I don't see solutions to this other than people leaving these towns or learning new skills.