See the fascinating study of Theodor H. Gaster, “Psalm 45,” Journal of Biblical Literature 74 (1955), pp. 239–251.