I. Bajo and S. Benayadi already gave a complete answer for your question in their paper entitled "Lie algebras admitting a unique quadratic structure""Lie algebras admitting a unique quadratic structure" in 1997, there you can find much more detailsdetail.