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

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

t2=Expand[t1]

SetAttributes[P,Orderless]

t2

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

t4=t3/. P[i_,j_]^2 :> d

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