OK, I finally found a solving path after being at this for hours.
I eventually found a breakthrough via a few observations:
Here, 4 and 5 must appear somewhere in the 3 middle orange squares. The green squares represent the positions that 6 can take and the yellow squares represent the positions that 3 can take. In fact, each of the 3 x 3 squares in each corner of the grid has a similar configuration.
The next thing I realised was that the 6 and 3 cannot be in the corner. If we try to place a 6 there, we will eventually run into a contradiction somewhere in the other 3 x 3 corner squares of the grid. Here is one example for 6:
Here, there is no way to place a 3 in the bottom-left corner. A similar contradiction arises for placing 3 in the bottom left corner.
This means the 6 must appear in either R1C2 or R2C1 and 3 must appear in R8C1 or R9C2. We can also extend this argument for all the corner 3 x 3 squares.
Lastly, 3 and 6 cannot appear in R9C2 and R1C2 together. This will force R4-6C8 to hold 4 numbers, as seen below:
Thus, 3 and 6 must appear in R8C1 and R1C2 respectively or R9C2 and R2C1 respectively. This also means that one of 3 or 6 must appear in the orange squares (R4-6C2).
Now, finally, for the breakthrough. If R4-6C2 were to be 4,5,6 in some order, then there is no room for a 7 in the middle left square. The 7 in R5C6 prevents placement in R5 and we cannot place 7 in any of the corners of the 3 x 3 square because it will form a L tetromino with consecutive digits. Therefore, the middle digits must be 3,4,5 instead. This lets us place the 3 and 6 and some other digits from chain deductions.
Since R4-6C2 is 3,4,5 in some order, 2 and 6 cannot appear in any of the corners of the 3 x 3 square. (otherwise, it will form an L-shape with consecutive digits). Similar arguments for the other squares.
Now, R2C7 cannot be an 8. If it was a 2, then it runs into a contradiction as both 1 and 9 are forced to R1C9. Therefore, it must be a 9. The only remaining numbers for R2 are 2 and 8. Since 2 already appears in C3, 2 must go in R2C1. This also means 2 must be in R9C2 of the bottom left 3 x 3 square. From there, we can make some more chain deductions:
Next, a few more deductions in several places:
R8C4-6 must be 4,5,6, so R8C7 and R8C9 must be 2 and 7. However, 7 cannot appear in R8C7 because it will form an L-shape.
Then, 5 must appear in R5C2. If it was 3 or 4, they will form an L-shape. Following that, 4 cannot appear in R4C2. So it must appear in R6C2 and 3 in R4C2.
Next, for R5, only 3, 8 and 9 are missing. 3 can only appear in R5C8 and after that, 9 can only appear in R5C5.
Next, it's time to finally make use of the 40. Counting along the diagonal, we have 6 + 8 + 7 + 7 = 28. Therefore, the sum of the remaining squares is 12. Currently, the bottom right square is missing a 1 and 8. If R7C8 was an 8 and therefore part of the sum for 40, we will have split 4 over the 3 remaining squares. That means there must be at least 2 '1's. However, that is impossible since 1 can only appear in one of those squares. Therefore, R7C8 is 1. From the corresponding deductions, we get:
Then, focus on the top middle 3 x 3 square. Note that 8 must be in either R1C6 or R3C4. Hence 6 cannot be in R2C4 since that prevents 8 from being placed in either of those squares. Similarly, 8 must appear in either R1C8 or R3C8. As a result, 6 cannot be in R2C6. Therefore, 6 must be in R2C5.
Now focus on the bottom middle 3 x 3 square. 6 cannot appear in R8C4 since that will cause 4 and 5 to form an L-shape with 2 and 3. Since 6 already appears in R2C5, this 6 must be in R8C6.
Next, note that the last column is currently missing a 2 and a 9. However, 2 cannot appear in R6C9 due to formation of an L-shape, so it must appear in R4C9. From there, there is a series of chain deductions involving the left-middle 3 x 3 square:
8 can now only go into R4C5. Since that diagonal must sum to 40, R3C4 must be 2. From the deductions that follow, we get:
Lastly, note that 6 cannot appear in R4C8 or it will form an L-shape otherwise. From there, it is routine to finish the grid from the chain deductions: