Whenever you attempt to unlock a chest or door, the game calculates a lockpicking score (L) and compares it to the lock difficulty (D). If L >= D, the attempt is a success; otherwise it fails. Unlike stealing, there is no random element in lockpicking.
The lockpicking score is simple to compute:
L = (cunning - 10) + 10 * [lockpicking rank]
Your lockpicking rank is the number of points you have in the Deft Hands tree. If you have Deft Hands alone, your rank is 1; if you have Device Mastery, your rank is 4. As you can see, each point in the Deft Hands/lockpicking tree is worth 10 points of cunning. Notice that you can actually open locks without any points in the lockpicking tree if your cunning is high enough (I confirmed this in-game).
If you successfully pick a lock, you'll gain XP equal to D (with a minimum of 5).
Great! But how high does your lockpicking score have to be to pick every pickable lock in the game?
1 Auto Success 10 Simple 20 Very Easy 30 Easy 40 Medium 50 Hard 60 Very Hard 10000 Impossible
So I would tentatively suggest that you need a lockpicking score of 60 to pick every lock that can be picked. You can achieve a lockpicking score of 60 by getting Device Mastery + 30 cunning, or Mech. Expertise + 40 cunning, etc. Of course, some locks will still require keys or event triggers to open.
In life, there are winners. Then, there are losers. Be jealous.