This totally depends on how the trap is designed! As the DM, you are the authority to which you should appeal. If you think of it before the thief starts messing with the trap (and therefore not yet indicating to you how they're approaching it and possibly biasing your choice), then you can just decide what kind of trigger this trap has.
However, if you only think of this after they've started their fiddling, this gets way more complicated. I've been there and know how it can sometimes feel awkward to be determining a character's fate with such an arbitrary decision. Often it won't matter ("No traps? I flip open the lock and toss back the li—" *stabbity-poison*, *dies*), but if the player is being particularly inquisitive or careful, or just doing something strange that might bypass one kind of trigger but not another, you end up in the position where your choice can end up deciding flat-out whether they "do the right thing" and avoid tripping it or not. It's often un-fun as the DM to just decide whether a PC suffers or not, and for those circumstances, dice are your friend.
You can appeal to the dice any time you don't want to decide yourself. You don't need a pre-written system for this, just your own sense of probability and fair play.
The simplest method is to abstract it and give them a 2-in-6 chance of triggering the trap. Maybe they avoided doing the thing that triggers it, maybe the trigger is just old or insensitive and didn't trip. This method has tradition going for it, since it's how trap triggering works in Basic D&D and its immediate derivatives.
The only-slightly-more complicated method is to grab a d6 and assign different outcomes to its numbers. For just one example based on my own trap tastes:
- 1-2 it triggers when the lid is opened
- 3-4 when something is poked into the lock
- 5-6 when the lock is opened
At this point, you may also want to decide/dice for how the trap would normally be disabled by someone with the key – that is, unless the chest owner designed the trap to trigger regardless of whether the actual key was used or not! Some dungeon-dwellers are mean like that.
You can get arbitrarily complex with a random-trigger generator. Start with something simple like that, and expand or refine it as you find it necessary during your campaign. For example, I might add a line that includes "triggers when half the treasure weight is removed from the chest", just to add spice. Expand the dice size as necessary, or roll 2 or 3 added together to get curved probabilities.
Eventually you will have a custom-to-your-tastes-and-needs, finely-tuned trigger random table that you can use when stocking dungeons or when deciding hazards on the fly.
There's another method for deciding this on the fly that eschews dice entirely, which is to go by the player's behaviour: the trap triggers when the player commits to the risky behaviour. "I unlock the chest!" without checking for traps? Trap springs as soon as they roll to unlock. You can describe the actual timing of the trigger any way you like, since the player has locked-in their course.
This method will appeal to some DMs and not others. If you choose this method, you might wish to add "Are you sure?" interrogatives as a regular part of your back-and-forth with your players, if you haven't already. Few things keep them on their toes more than the DM asking for confirmation of a risky choice, especially when there doesn't seem to be any unfortunate results when they go ahead anyway. Then, the times that they do suffer the consequences, it's clear that they walked into their fate willingly.
Further to "it depends on the nature of the trap", you might find "Appendix A: Random Dungeon Generation", Table V.-I on page 171 of the Dungeon Master's Guide (1st edition) helpful as well. It's a table that you pick from or roll on to determine the nature and trigger for a trap.
It gives a variety of trap types, providing inspiration, and it demonstrates several ways in which a "locked chest" may be trapped in ways that may or may not be directly connected to the lock – just because a chest is both locked and trapped doesn't mean they have to be connected! In fact, the less predictable such a connection is in their experience, the more incentive your players will have to take nothing for granted about such dangerous objects as chests in dungeons.