It is inconceivable that the courts of law could override statutes.
The courts are bound by statutes, and only have leeway in interpreting
them where they are vague.
This overstates the situation, at least in U.S. law.
Courts, of course, do sometimes override statutes.
Courts invalidate statutes on the ground that they are unconstitutional (in the case of state legislation under the federal or state constitution, and in the case of local ordinances under the federal or state constitutions or under a local government's charter), and less frequently, on the ground that subsequent legislation or a new treaty has implicitly repealed or modified an old statute.
A state law can be invalidated on the grounds that it conflicts with federal statutes or treaties and/or regulations, and a local law can be invalidated on the grounds that it conflicts with federal treaties, and/or federal or state statutes, and/or federal or state regulations.
While one can argue over whether it is a matter of statutory interpretation or is an actual invalidation of a statute, a court can also make a determination that a statute is "spent" (for example, in the case of legislation authorizing something to be done that has already happened, such as spending money or allowing the executive branch to purchase real estate for some purpose), or has expired without further legislative action as legislation on the books already provided (this happens a lot in the case of tax provisions that have sunset terms in order to comply with Congressional budgetary rules).
Courts can also interpret a statute in a manner that seemingly conflicts with the plain textual meaning of the statute, in order to avoid a finding of unconstitutionality, implicit repeal, or an absurd interpretation of the law viewed in context and as a whole.
Courts can invalidate regulations on a variety of grounds including:
(1) unconstitutionality on the merits,
(2) unconstitutionality on the grounds that they represent excessive Congressional delegation of authority to the executive branch,
(3) implicit repeal by later statutes or regulations, or by statutes or regulations of another higher level of government which has supremacy over the regulation in question,
(4) procedurally improper adoption or repeal of regulations under the federal Administrative Procedures Act (or parallel state or local administrative procedures related to regulatory actions),
(5) substantively improper adoption or repeal of regulations under the Administrative Procedures Act because the administrative record at the time of agency regulatory action does not adequately support the agency's regulatory action,
(6) substantively improper content because the regulations are not a reasonable interpretation or implementation of a statute, or
(7) substantively improper content because it exceeds the scope of regulatory authority authorized by the statute, i.e., that the regulation was an ultra vires act of the agency.
The U.S. Supreme Court in just the last year, under its new 6-3 conservative majority, has also articulated a new basis for overturning regulations called the "major questions doctrine". This doctrine is basically a hardening of the traditional non-delegation doctrine analysis in certain circumstances even when the legislation in question can plausibly be read to confer upon the executive branch the authority to issue a regulation of the kind adopted. As explained at this New York Times link:
It has been only eight months since the Supreme Court first invoked
the “major questions doctrine” by name in a majority opinion, using it
to limit the Environmental Protection Agency’s power to address
climate change. Last week, the court seemed poised to use it again, to
kill the Biden administration’s plan to cancel more than $400 billion
in student loans. . . .
The idea behind the major questions doctrine is that Congress must
speak particularly clearly when it authorizes the executive branch to
take on matters of political or economic significance.
As in the case of legislation, while one can argue over whether it is a matter of statutory interpretation or is an actual invalidation of a regulation, a court can also make a determination that the regulation is "spent", or has expired by its own terms.
Courts can also interpret a regulation in a manner that seemingly conflicts with the plain textual meaning of the regulation, in order to avoid a finding of unconstitutionality, to avoid a conflict with the legislation authorizing the regulation, to avoid implicit repeal, or to prevent an absurd interpretation of the regulation viewed in context and as a whole.
The bottom line is that there are indeed many grounds to invalidate a regulation, although not necessarily the one contemplated in the question.
The courts can also determine that a formal or informal policy or practice of an agency amounts to a regulation and is subject to judicial review on the grounds set forth above, even though the agency itself has not framed that formal or informal policy or practice in terms of it being a regulation.
The line between what constitutes a mere exercise of law enforcement or executive branch discretion by an agency on a basis that does not actually amount to a regulation, and what actually constitutes a regulation in cases where the agency does not follow the Administrative Procedure Act regulatory process, is often not clear cut.
For example, while the I.R.S. provides as a matter of law that some of its statements on its website and in its taxpayer oriented publications and instructions have the legal force of a regulation, most other federal government agencies do not. But a court could rule that a statement on the webpage another government agency or in a publication of another government agency or an internal memorandum in some agency actually is a de facto regulation and is subject to judicial review on the same basis as a regulation.
Can the courts say something like "okay, this regulation has not been
updated for long, it no longer reflects the modern realities, so we
create this case law allowing to deviate from the regulation"?
Not unless the modern reality is a change in legislation or constitutional case law affecting something in the substantive content of the regulation.
For example, a court could invalidate a portion of a regulation defining marriage as only opposite sex marriages for purposes of some administrative program, even though the regulation has not been formally updated to reflect the fact that same sex marriages must now be recognized as a matter of constitutional law.
But, while the principle of stare decisis allows a court to determine that old case law should no longer be given the effect that it once had in light of changing case law, legislation, and the real world context to which the old cases are applied, this usually cannot be done in the case of regulations.
For example, the regulatory determination that marijuana is a Schedule I controlled substance, which includes a requirement that the regulator determine that marijuana has no legitimate medicinal purpose cannot be invalidated on the basis of a court determination that there are now legitimate medicinal purposes for marijuana, even though three-quarters of U.S. states have legalized marijuana for medical purposes.
Instead, the past regulatory decision can only be revisited through an Administrative Procedure Act authorized process to amend the regulation in question.
The closest the courts get to a determination of this kind about a regulation would be a determination that a regulation is implicitly "spent".
For example, a regulation that implicitly assumes that some particular war that was pending when the regulation was adopted (e.g. World War II) is underway, even though it doesn't expressly state that the regulation only applies for the duration of that war, might be held by a court to be "spent."