Whilst it is better to charge straight onto the battery, you /can/ charge onto the terminals in the engine bay. The terminals are there for jump-starting the engine.
Once you have connected a charger, battery or another vehicle to the engine bay terminals, you should be able to unlock the boot. Problem with a charger is a small one may not have enough go in it to power up the systems but most will power up the first key position to unlock the boot (don't try the windows until the battery holds enough charge). Some chargers can be used for jump-starting, these are ok to switch on the ignition and start up.
Please do not use WD40 on a lock, it is a de-watering solvent and will wash all the lubricant out of the mechanism. It is not a lubricant.
You can squirt some 3-in-1 into it but this can air-harden into a gum, better to use a proper lubrication oil such as SAE30 (lawnmower) or even chain saw oil, from a can. A decent oil for "fishing reels" comes in a little clear tube with a handy "hypodermic" tube, got some in Halfords.
Do you know why your battery is flat? - you may need a new one, and it is a jolly good idea to check all the earth points (mainly engine bay) for corrosion and poor contact (electrical connections do corrode very easily).