The passage is headlined as "A Psalm of David". The Psalm is therefore attributed to David, and this could mean either it was composed by him or by someone in his court. It also suggests that it was sung by him, as the Tanakh elsewhere calls David "the sweet Psalmist of Israel". (2 Samuel 23:1) One may propose that the Psalm was not actually composed by a real David living c. 1000 BC, but in any case the Psalm holds itself out as written by such a person.
Since the text was written by Jews, let's use the Judaica Press Tanakh (JPT) translation, which could also help us avoid Christian bias in interpreting the passage. The Psalm begins by describing the narrator's distress, and then his killing by enemies:
David's words that he spilled like water, his bones separated, his heart melted, and God laid him in the "dust of death" show that he is talking about his death, and his description of predators opening their mouths against him and sharing his clothes show that he was killed.1. a song of David.
2. My God, my God, why have You forsaken me? [You are] far from my salvation [and] from the words of my moaning.
3. My God, I call out by day and You do not reply, and at night I do not keep silent.
...
13. Great bulls have surrounded me; the mighty ones of Bashan encompassed me.
14 They opened their mouth against me [like] a tearing, roaring lion.
15. I was spilled like water, and all my bones were separated; my heart was like wax, melting within my innards.
16. My strength became dried out like a potsherd, and my tongue cleaves to my palate; and You set me down in the dust of death.
17. For dogs have surrounded me; a band of evildoers has encompassed me, like a lion, my hands and feet. [or “they gouged my hands and feet” in the Septuagint]
18. I tell about all my bones. They look and gloat over me.
19. They share my garments among themselves and cast lots for my raiment.
The narrator suggests to his audience that he resurrected, since he next describes his assurance of God saving him in v. 9 and then describes his salvation and praising God among his people in verses 20-26 (JPT):
After describing his death David says that he will praise God among his brothers and in the congregation, so he means that he would resurrect to make these praises. Since "hearts" refer to souls, as in Psalm 16:10-11, David speaks of the general resurrection when he says that their "hearts shall live forever". Since earlier in the passage he spoke of the "dust of death" and the Tanakh speaks of the dead as returning to "dust" (Gen 3:19), the narrator of Psalm 22 (JPT) is talking about the future resurrection when he adds that those in the dust shall kneel (22:27,30 JPT):9. One should cast his trust upon the Lord, and He will rescue him; He will save him because He delights in him.
...
20. But You, O Lord, do not distance Yourself; my strength, hasten to my assistance.
21. Save my soul from the sword, my only one from the grip of the dog.
22. Save me from the lion's mouth, as from the horns of the wild oxen You answered me.
23. I will tell Your name to my brothers; in the midst of the congregation I will praise You.
24. You who fear the Lord, praise Him; all the seed of Jacob, honor Him, and fear Him, all the seed of Israel.
25. For He has neither despised nor abhorred the cry of the poor, neither has He hidden His countenance from him; and when he cried out to Him, He hearkened.
26. Because of You is my praise in the great congregation; I pay my vows in the presence of those who fear Him.
For those who read Hebrew and wish to decide which translation is best for the underlined verse 30, the Hebrew is provided below:27. The humble shall eat and be sated; they shall praise the Lord, those who seek him; your hearts shall live forever.
30. They shall eat all the best of the earth and prostrate themselves; before Him shall all those who descend to the dust kneel, and He will not quicken his soul.
[or "all those at death’s door, whose spirits flag, shall bend the knee before Him." in the rabbinical Jewish Publication Society translation]
אכלו וישתחוו ׀ כל־דשני־ארץ לפניו יכרעו כל־יורדי עפר ונפשו לא חיה׃
(SOURCE: http://biblehub.com/text/psalms/22-29.htm )
I think the JPS is closer and that it means something like "All who are alive on earth will bow down, as will those who go down to the dust and cannot keep their/his own soul(s) alive, which none can."
David, singer of the Psalms