I checked your results , they are correct.
They are always 3 adjacent matrices products ordered from 1 to 3. Let identify the products by this index, they are 6 but 2 are equivalent.
$123$ : $OP[( (M_m^n M_n^p ) M_p^n ) M_n^q] = n mp + OP[( M_m^p M_p^n ) M_n^q] = n mp + p mn + OP[M_m^n M_n^q] = n mp + p mn + n mq$
$132$ : $OP[(M_m^n M_n^p) (M_p^n M_n^q )] = n mp + OP[(M_p^n M_n^q )] = nmp + npq + OP[M_m^p M_p^q ] = n mp + n pq + p mq$
$312$ : $( M_m^n M_n^p ) ( M_p^n M_n^q )$ identical to the previous
$213$ : $OP[(M_m^n ( M_n^p M_p^n )) M_n^q] = p nn + OP[(M_m^n M_n^n ) M_n^q] = p nn + n mn + OP[M_m^n M_n^q ] = p nn + n mn + n mq$
$231$ : $OP[M_m^n ((M_n^p M_p^n) M_n^q))] = p nn + OP[M_m^n (M_n^n) M_n^q)] = p nn + n nq + OP[M_m^n M_n^q] = p nn + n nq + n mq$
$321$ : $OP[M_m^n ( M_n^p ( M_p^n M_n^q ) )] = n pq + OP[M_m^n ( M_n^p M_p^q) ] = n pq + p nq + OP[ M_m^n M_n^q ] = n pq + p nq + n mq$
copy past in scratchpas of firefox and then type (Ctrl+L) to show the result
var res , m=11 , p=8 , n=15 , q= 18 ,
A = n*m*p + p*m*n + n*m*q ,
B = n*m*p + n*p*q + p*m*q ,
C = p*n*n + n*m*n + n*m*q ,
D = p*n*n + n*n*q + n*m*q ,
E = n*p*q + p*n*q + n*m*q ;
res = A+" "+B+" "+C+" "+D+" "+E ;
/*
5610 5064 7245 8820 7290
*/
$(M_m^n M_n^p) (M_p^n M_n^q ) = 5064$ is the lower way to compute, as you found.