K=X[6,4,1,3]X[4,2,5,1]X[2,6,3,5]

t1 = K /. X[i_,j_,k_,l_] :> A*p[i,l]*p[j,k]+B*p[i,j]*p[k,l]

t2=Expand[t1]

t3=t2 //. p[a_,b_]p[b_,c_] :> p[a,c]

t4=t3 /. {
p[a_,a_] :> d,
p[a_,b_]^2 :> d
}

t5=t4 /. {B->1/A, d->(-A^2-1/A^2)}

t6=Expand[t5]