Try lubricating the lock, if no oil/grease at hand try a HB pencil and rub the lead over the key.
Then retry to open the lock fully jiggling the key as you go. Once off split the battery case and replace the lock with a new one from ebay (circa £5).
If still no luck check out youtube for ebike battery/lock picking vids. if the vids i found dont show up for you search for lock raking/bumping/picking.
Its not a tricky lock pick but could take you time to gain/hit the knack, then again you could hit it on jiggle attempt #1..
Walking the bike into a Brick and Mortar actual shopfront for a locksmith (if available in your locality) may get you a quick cheap deal on a one off by a board pro. BUT DO NOT CALL a 24hour locksmith service a new bike would probably be cheaper. ..
bon chance..
If i have misunderstood the problem? please post pictures to illustrate.