count the number of calls of a clause

What you actually want is something slightly different: You want to count the number of answers (so far) of a goal.

The following predicate call_nth(Goal_0, Nth) succeeds like call(Goal_0) but has an additional argument which indicates that the answer found is the n-th answer. This definition is highly specific to SWI or YAP. Do not use things like nb_setarg/3 in your general programs, but use them for well encapsulated cases as this one. Even within those two systems, the precise meaning of these constructs is not well defined for the general case. Here is a definition for SICStus. Update: use unsigned_64 in newer versions instead of unsigned_32.

call_nth(Goal_0, Nth) :-
   nonvar(Nth),
   !,
   Nth \== 0,
   \+arg(Nth,+ 1,2), % produces all expected errors
   State = count(0,_), % note the extra argument which remains a variable
   Goal_0,
   arg(1, State, C1),
   C2 is C1+1,
   (  Nth == C2
   -> !
   ;  nb_setarg(1, State, C2),
      fail
   ).
call_nth(Goal_0, Nth) :-
   State = count(0,_), % note the extra argument which remains a variable
   Goal_0,
   arg(1, State, C1),
   C2 is C1+1,
   nb_setarg(1, State, C2),
   Nth = C2.

A more robust abstraction is provided by Eclipse:

call_nth(Goal_0, Nth) :-
   shelf_create(counter(0), CounterRef),
   call(Goal_0),
   shelf_inc(CounterRef, 1),
   shelf_get(CounterRef, 1, Nth).
?- call_nth(between(1,5,I),Nth).
   I = Nth, Nth = 1
;  I = Nth, Nth = 2
;  I = Nth, Nth = 3
;  I = Nth, Nth = 4
;  I = Nth, Nth = 5.

So simply wrap it around:

lock_open :-
   call_nth(conditional_combination(X), Nth),
   X = [8,6,5,3,6,9],
   !,
   ....

If you are using SWI prolog you can use nb_getval/2 and nb_setval/2 to achieve what you want:

lock_open:- 
  nb_setval(ctr, 0),  % Initialize counter
  conditional_combination(X), 
  nb_inc(ctr),  % Increment Counter
  equal(X,[8,6,5,3,6,9]),
  % Here you can access counter value with nb_getval(ctr, Value)
  !, 
  print(X).

nb_inc(Key):-
  nb_getval(Key, Old),
  succ(Old, New),
  nb_setval(Key, New).

Other prologs have other means to do the same, look for global variables in your prolog implementation. In this snippet I used the term ctr to hold the current goal counter. You can use any term there that is not used in your program.