Can i plug a usb keyboard to my iphone while it's connected to my mac?
Not a USB keyboard afaik, but this lightning keyboard has been reported to work with iPhones.

There's a thread on the apple discussion board by someone in the same situation as you that used the keyboard linked above as part of their backup process.