The way to do this is to find a mirror that has a specific 5.4 repository and point yum at that instead of the default configuration of pointing at a repository for CentOS 5 (which is going to upgrade to 5.5, 5.6, etc. as they are released).
Alternatively, especially at this point if you install from a 5.4 + 5.4-updates source, you could just remove your yum configuration for the upstream CentOS repositories entirely since there aren't any upgrades for it anymore.
But I should point out that this is likely a very bad thing to actually do as it will potentially leave you open to all sorts of security vulnerabilities, etc. and that it would almost certainly be more productive to find out what the specific requirements are and find a way to satisfy those on newer versions of CentOS (ideally removing those requirements entirely when possible).