Thats easy, if its your phone go into the settings to wipe it, you will see "erase all content and settings". This will wipe your phone so none of your information is on it anymore, but it will require your password to do so. If you have find my iphone turned on, it will also instruct you to turn that off first, which will also require your icloud password to do so.
Once you see it wiping and rebooting, you will then see the setup screen asking to put in your icloud ID and password. At this point the icloud lock is removed, as it is asking you to enter yours to set the iphone up as your own (which you can show the buyer that screen then proving its unlocked, but dont let them enter their ID and password until you have cash in hand).
You may also want to wait to erase it so they can tap around on it a bit to make sure its working as expected first. Then if they want to pay and you have cash in hand, do the erase all content and settings in front of them so they can see it wiped (but turn the phone away when entering your icloud ID and password of course!).