UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sv1l/gtKf1WF7MkRmvfptJGI/bdJLJ+2aZf/gnFxkoI=' 
WHERE 
  key_id = '6a1b37c83d863df30ef31f27a64c02184bdc163ab4f124b5768a3706930642b2' 
  AND (
    token = 'sv1l/gtKf1WF7MkRmvfptJGI/bdJLJ+2aZf/gnFxkoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030