UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AXuTHZs0tLf64Nyh9qpoUTGr7lm2Ga1Fj1PD8wf6C4I=' 
WHERE 
  key_id = '3640269548b1a1da68412ad980ff8e8cb141ff954e2c46b1bdfe063046002742' 
  AND (
    token = 'AXuTHZs0tLf64Nyh9qpoUTGr7lm2Ga1Fj1PD8wf6C4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043