If you are referring to Activation Lock there is nothing you can do except ask the seller if they know the person who set the lock. I doubt they do since they didn't know if the iPhones were locked or not. Since they told you this in advance you have no claim to make against the seller, you can ask politely if they will refund your money.
If you are referring to passcode lock do this: If you forgot the passcode for your iPhone, iPad, or iPod touch, or your device is disabled - Apple Support
If you are saying the phones are locked to a carrier you will need to contact AppleCare, give them the model and serial numbers and tell them you just want to know which carrier(s) they are locked to. You will then need to contact the carrier and ask what their unlock policy is and if you qualify.