if in side mount, roll slightly towards the arm being attacked. if you can, reach across and grab your own hand/wrist with your free hand. bring your bottom knee up under his arm that is applying the pressure, he cant move it any further, so sorry, no sub. in mount (and in time you should never get caught in a keylock with the guy mounted on you) reach across with the free hand, grab your hand/wrist as in above, this time force your opponent back over the top of you, if you study your hands in this position, you can see that it is very easy to now roll his wrist backwards, as it is trapped between your hands. Now you get the sub, well maybe, BJJ guys generally dont count wrist locks as good technique. Our school, a submission is a submission, real simple.