You can treat the two blocks and chain as a system. The tension of the chain leads to internal forces that cancel within the system. I think the problem is unintentionally ill-posed: The upward force of 320N is less than the total weight of the the (24 + 30 + 10) kg system which is about 640 N. If that really is the intention, then:
a = (320 - (24+30+10) kg * 9.8 N/kg)/(24+30+10) = -4.8 m/s2 (i.e. accelerating downward)
To find tension at top of chain, do a force balance on the 30 kg mass: FNet = ma
320N - 30kg*9.8N/kg - T = 30kg (-4.8 m/s2) and solve for T which is equal to the force of 30 kg mass on the chain by 3rd Law.