UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8leFqlDruPg2heZF5NHs2u/9+0IM2PaW8cL2UXoY+aQ=' 
WHERE 
  key_id = '008347c1b57bbd9214800b6f0b8117069867a6d4aeee146cb32e3b4de77fbfb1' 
  AND (
    token = '8leFqlDruPg2heZF5NHs2u/9+0IM2PaW8cL2UXoY+aQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033