Exhibit 10.4

SECOND AMENDMENT

TO THIRD AMENDED AND RESTATED
CRUDE PIPELINES AND TANKAGE AGREEMENT

This Second Amendment to Third Amended and Restated Crude Pipelines and Tankage
Agreement (this “Amendment”) is entered into on May 26, 2020, to be effective as
of May 26, 2020 (the “Second Amendment Effective Date”) by and among:

1.HollyFrontier Navajo Refining LLC, a Delaware limited liability company
(“Navajo Refining”),

2.HollyFrontier Woods Cross Refining LLC, a Delaware limited liability company
(“Holly Refining – Woods Cross”),

3.HollyFrontier Refining & Marketing LLC, a Delaware limited liability company
(“HFRM”, together with Navajo Refining and Holly Refining – Woods Cross, the
“HollyFrontier Entities”),

4.Holly Energy Partners - Operating, L.P., a Delaware limited partnership (the
“Operating Partnership”),

5.HEP Pipeline, L.L.C., a Delaware limited liability company (“HEP Pipeline”),
and

6.HEP Woods Cross, L.L.C., a Delaware limited liability company (“HEP Woods
Cross”, together with the Operating Partnership and HEP Pipeline, the
“Partnership Entities”).

Each of the HollyFrontier Entities and the Partnership Entities are individually
referred to herein as a “Party” and collectively as the “Parties.”

WHEREAS, the Parties desire to amend certain provisions of the Third Amended and
Restated Crude Pipelines and Tankage Agreement, effective as of March 12, 2015,
(as amended to date, the “Agreement”) by and among the HollyFrontier Entities
and the Partnership Entities as set forth herein; and

WHEREAS, HEP Pipeline has constructed and installed the system upgrades and HFRM
has agreed to reimburse HEP Pipeline for the cost of such upgrades all as
provided herein;

NOW, THEREFORE, in consideration of the covenants and obligations contained
herein, the Parties hereby agree as follows:

ARTICLE 1
AMENDMENTS

1.1    Amendment to Section 2. Section 2 of the Agreement is hereby amended by
adding subsection (w) as follows:

“(w)    Hobbs System Expansion.

(i)    Effective as of the Hobbs Expansion Commencement Date, the HollyFrontier
Entities shall pay to the Partnership Entities a pump-over fee of $0.22 per
barrel for all barrels received at the Hobbs Station terminal in Hobbs, New
Mexico from Plains Pipeline, L.P. (the “Hobbs Pump-Over Fee”). The Hobbs
Pump-Over Fee shall (A) remain in effect until the Partnership Entities have
received aggregate Hobbs Pump-Over Fees in respect of the Hobbs System Expansion
equal to $600,000, and (B) be in addition to the Minimum Trunk Pipeline Revenue
Commitment.
(ii)    From the Hobbs Expansion Commencement Date until the last day of the
month following the month in which the Partnership Entities have received the
full amount to which they are entitled with respect to the Hobbs System
Expansion, the Partnership Entities shall provide the HollyFrontier Entities
with written notice of their calculation of the Hobbs Pump-Over Fee by no later
than 30 days following the end of each calendar month. The notice will include
an aggregate balance of the Hobbs Pump-Over Fees paid by the HollyFrontier
Entities since the Hobbs Expansion Commencement Date.
(iii)    If the HollyFrontier Entities disagree with the Partnership Entities’
calculations in respect of the Hobbs Pump-Over Fee, then HollyFrontier Entities
will notify the Partnership Entities and a senior officer of HollyFrontier and a
senior officer of the Partnership will negotiate in good faith to resolve any
differences with respect to such calculations. If such differences are not
resolved within 30 days following the Partnership Entities’ delivery to the
HollyFrontier Entities of the Hobbs Pump-Over Fee calculations, the
HollyFrontier Entities and the Partnership Entities shall submit any and all
matters which remain in dispute to arbitration in accordance with Section
12(e).”
1.2    Amendment to Section 6. Section 6 of the Agreement is hereby amended by
adding the following to the end thereof:
“If the amount contemplated in Section 2(w)(i) has not been paid to the
Partnership Entities at the time this Agreement is terminated in accordance with
its terms, then, notwithstanding anything in this Agreement to the contrary, any
amounts then owing in respect of Section 2(w)(i) shall be paid to the
Partnership Entities not later than the third business day following such
termination.”
1.3    Amendment to Annex A.
(i)    Annex A to the Agreement is hereby amended to add the following
definition in the proper alphabetical sequence:
“Hobbs Expansion Commencement Date” means June 1, 2020.
“Hobbs System Expansion” means the following construction in 2020: (A)
connection facilities at the Hobbs Station terminal in New Mexico allowing for
additional third party crude deliveries to such terminal and (B) additional
pumps and pumping capacity to the Hobbs to Lovington 8-inch pipeline enabling an
additional 10,000 barrels per day of Crude Oil to be transported between the
Hobbs Station terminal in Hobbs, New Mexico and the Lovington Refinery.
(ii)    Annex A to the Agreement is hereby amended to add the following
definitions to the defined term table in proper alphabetical sequence:
Term
Section
“Hobbs Pump-Over Fee”
Section 2(w)(i)

ARTICLE 2

MISCELLANEOUS
2.1    Counterparts. This Amendment may be executed in counterparts each of
which shall be deemed an original. An executed counterpart of this Amendment
transmitted by facsimile shall be equally as effective as a manually executed
counterpart.

2.2    Successors and Assigns. Section 12(b) of the Agreement is hereby
incorporated by reference into this Section 2.2, mutatis mutandis.

2.3    Entire Agreement. The Agreement, as amended by this Amendment, contains
the entire agreement between the Parties as to the subject matter of the
Agreement and, except as provided for in this Amendment, the terms and
provisions of the Agreement shall remain in full force and effect as originally
written.

[Remainder of page intentionally left blank. Signature pages follow.]

IN WITNESS WHEREOF, the undersigned Parties have executed this Amendment as of
the date first written above to be effective as of the Second Amendment
Effective Date.

PARTNERSHIP ENTITIES:

HOLLY ENERGY PARTNERS - OPERATING, L.P.
HEP WOODS CROSS, L.L.C.
HEP PIPELINE, L.L.C.

By:     /s/ Richard L. Voliva III    
Name: Richard L. Voliva III
Title:     President

HOLLYFRONTIER ENTITIES:

HOLLYFRONTIER NAVAJO REFINING LLC
HOLLYFRONTIER WOODS CROSS REFINING LLC
        
    
By:     /s/ Thomas G. Creery    
Name: Thomas G. Creery
Title:     Senior Vice President, Commercial

        
HOLLYFRONTIER REFINING & MARKETING LLC

By:     /s/ Thomas G. Creery    
Thomas G. Creery
President

1