I think it would be helpful if we could have distinct names for the two limits here – keep “sigop” for signatures that appear in the p2sh, p2wsh and the output scriptPubKey, and use something new for the new limit (“sigchecked”? “legacysig”?)
The condition is whether the script is OP_1
… OP_16
immediately followed by CMS, versus anything else, not strictly the number of keys. So eg 1 1 ADD CMS
will be treated as 20 sigops, not 2, and 0 0 0 CHECKMULTISIG
also counts as 20 sigops, rather than 0. It also counts CHECK*SIG opcodes from unexecuted branches, so IF <P> CHECKSIG ELSE <Q> CHECKSIG ENDIF
counts as 2 sigops while IF <P> ELSE <Q> ENDIF CHECKSIG
counts as 1.