Apple Magic Keyboard connected in Wired mode - turn Bluetooth off
Yes, it works well when connected via Lightning cable only with Bluetooth disabled or enabled. I just tested it. 

By the way, the keyboard charge lasts about 3-4months with everyday typing. 5min charge can last you hours. The Magic keyboard's battery last much, much longer than previous editions.