UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N6E3V2CBDklozZrvSe+mUdsLmJCY3D8U5k6avOa8DV8=' 
WHERE 
  key_id = 'ad5ba195cf948605901ce93187ccb328dfa932b904cec8fc9c7c422b90dee59c' 
  AND (
    token = 'N6E3V2CBDklozZrvSe+mUdsLmJCY3D8U5k6avOa8DV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026