I'll go ahead and try my hand at a proof of optimality.
The lock has three numbers; we will call the first the $x$-coordinate, the second the $y$-coordinate, and the third the $z$-coordinate. It helps to think like JonTheMon said, of a 3D version of battleship, but I won't refer specifically to this intuition.
Let's start with an easier example. Suppose the $y$ and $z$ coordinates must be from the numbers $\{1, 2, 3\}$ instead of $\{1, 2, .., 8\}$, but the $x$-coordinate could be any number from $\{1, 2, ..., 8\}$, which is 72 total possibilities. Can this be done with only 6 checks? Well, no. By the pigeon hole principle, there must be some $x$ coordinate, say $x = 1$, such that none of the checks start with $x = 1$. But the nine possibilities that start with one ($(1, 1, 1)$, $(1, 1, 2)$, $(1, 1, 3)$, $(1, 2, 1)$, etc.), must be covered by six checks, and each check can only cover one possibility. Hence it is impossible to do this easier problem with six checks.
Now to the full problem. Suppose only 31 checks are needed to open the lock. By the pigeon hole principle, there must be some number $x$ between $1$ and $8$ such that only three of the checks start with the number $x$. Without loss of generality, assume $x = 1$. Let's say these three checks are $(1, y_1, z_1)$, $(1, y_2, z_2)$, and $(1, y_3, z_3)$. Since there are five numbers not in the set $Y = \{y_1, y_2, y_3\}$ and five numbers not in the set $Z = \{z_1, z_2, z_3\}$, that makes $25$ combinations that start with $1$ not covered by these three checks. Each of these $25$ possibilities require distinct checks, and furthermore these $25$ distinct checks must have neither their $y$ nor $z$ coordinate in $Y$ or $Z$ respectively.
This means the 72 combinations$^*$ of the form $(x, y, z)$ for $x \in \{1, 2, .., 8\}$, $y \in Y$, and $z \in Z$ are covered by just six checks (since the other 25 can only have the $x$-coordinate correct for these 72 combinations). But this is impossible, as we've already demonstrated. QED.
$*$: Note that the above assumes $y_1 \neq y_2$, $y_1 \neq y_3$, $z_1 \neq z_2$, etc. But if any of these $y$ or $z$ values were the same, then there would be at least $30$ possibilities not covered instead of $25$, which is clearly impossible.
28
instead of22
? $\endgroup$