Well I have found out a solution. First of all this looks like a notorious bug, for what I read around it seems there is no safe way to break out from this prison without incurring in this bug, but this I cannot confirm to be honest. The way I have escaped anyway it seemed legit to me. I had already completed the "No one escape Cidhna mine" quest and at this time there was no NPC inside to interact in any way nor door's locks to pick. There is a passage though (some duct at the end of one of the mine corridors) that connects Cidhna mine to Left hand mine and through this way one can escape. What happened was that although I was set free and neither guards would attack me or be suspicious I was not able to sleep unless I served time in the prison. Sleeping in beds from anywhere would teleport me to Cidhna mine exit with time served (several days) and skills levelup xp reset. My bounty was quite big, the reset incurred would have been the maximum for this case, all skill level up xp brought back to zero. Anyway I had to serve jail nonetheless to fix the sleep bug so I committed a petty crime in front of guard and paid the bounty but I was still sent into prison regardless the fact I paid the damn bounty. At this point I didn't escaped but I served the time (use the pickaxe on the ore node). To my surprise I was out the next day with no skill xp lost or very negligible loss. Seems the time served was calculated with the last offence (another bug lol). Anyway I am not sure if my save is fine, but lesson to be learned is never do jail time in Markhat. bye bye