How can Inner join be optimize?
Is there a difference if I put the where condition at the join
  section?


In your case, NO. Optimizer is smart enough to understand.

Where Clause further put filter on what is produce by JOIN.

INNER JOIN :Here WHERE clause do not have much to to put filter.It has smaller resultset to apply filter.  In fact, in case of, INNER JOIN, it do not matter where you put condition in the JOIN or WHERE. Optimizer is smart enough to understand.There is no performance difference .

OUTER JOIN: Here WHERE clause  have much larger resultset to apply filter.
Since Where clause have much larger resultset to filter out, it make sense to Filter as much as possible in JOIN ON condition,so that smaller resultset is produce.

If where condition is applied in Right table ,then such LEFT JOIN is equivalent to INNER JOIN

Though in most cases of OUTER JOIN, optimizer is smart enough to understand and convert the WHERE to ON internally.

It depend upon example to example, specially in complex query involving large volume of data.It is always wise to check the query plan and decide WHERE condition accordingly.

You should use predicate column in ON ,which logically relate the joining table.

If it is filter condition then use it in Where clause.


  Should I add an index for the timestamp, row_id, session_id?


Yes. Create composite Non clustered index.Choice of Clustered index([id]) is perfect.

Create NonClustered Index NCI_Table_Action_Row_Session_Timestamp 
on table_name(action_id,row_id,session_id,Timestamp)
GO


Notice the order of columns. The narrow column should be in LEFT most.
There is no point in Covering index as nvarchar(max) are not use in covering index.


  What else can I do to make it run faster?


I think instead of INNER use EXISTS.Don't use *

SELECT d.[id]     ,
      [session_id] ,
      [row_id]     ,
      [timestamp]  ,
      [action_id] ,
      [value1]     , 
      [value2]     ,
      [value3]       
FROM [table_name] d 
where(select 1 from [table_name] i 
   where  i.[id] = X -- where X is the input
  AND i.[action_id] = 11 ---- where 11 is the input
  AND  d.[action_id] = i.[action_id]+1 --12 ---- if 12 is  input then it is more good
  AND d.[session_id] = i.[session_id] 
   AND d.[row_id] = i.[row_id] 
   AND d.[timestamp] = i.[timestamp] 

   )