I'm a little confused about the conversation of having to restore the phone to unlock it.
Since I'm selling, I should request that ATT unlock it first and then erase all my data? Would the phone still be unlocked for the buyer?
It doesn't really matter which order you do things in.
You'll want to erase all of the data on the phone, so you should do that before selling it.
As long as the unlock has been approved by AT&T (and they've told you that your iPhone is ready to be unlocked), any restore after that point will leave you (or whoever buys it) with an unlocked iPhone.
The unlock is tied to the device, not to you as a customer/user of Apple or AT&T.