UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fKSOTQHce4amvUNajf7gGFVRvBGlLCZKA97c194tuHA=' 
WHERE 
  key_id = 'a408450d6a966f877ec147f77527b6a10da76404d01db779c609553bd5884259' 
  AND (
    token = 'fKSOTQHce4amvUNajf7gGFVRvBGlLCZKA97c194tuHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048