It's not usually riveted on; usually safety torx bits or phillips heads in my experience. Never seen a riveted one. Also you shouldn't have to pay $160 for a reman'd one, they're about $80 here in Arkansas at most stores so I can't imagine they're that much more elsewhere.
Definitely stay away from a junkyard unit if possible. Often junkyard vehicles are there due to poor upkeep and previous owners wouldn't care about a bad MAF or other sensors as long as the car still runs. Also since batteries are usually disconnected upon arrival there's no way to pull CEL codes and see if it's been throwing a bad MAF code.
Paying the extra money for a new/reman'd sensor will be worth it for how long it lasts... you get what you pay for.