The first of your two examples is less clumsy than the second, but both are ambiguous or unclear. The examples in Shyam's answer remove the ambiguity by replacing it with the solution:
But when C happens, it depends only on Condition A.
→ But when C happens, the solution depends only on Condition A.
However, there is a problem with the first sentence when combined with the second, as the two contradict each other. The first sentence says the solution depends on Condition B and the second sentence says the solution does not depend on Condition B. Some possible re-wordings (sadly, convoluted or prolix) are shown below. It seems that while the dependencies among Conditions A, B, C are not particularly complex, they are difficult to state briefly, correctly, elegantly.
The solution depends on Conditions A and B, except only on A when C happens.
The solution depends on Condition A; solely on A when Condition C occurs, else on B as well.
If Condition C occurs, the solution depends only on Condition A; otherwise, it depends not only on A, but also on B.